// run: $exec < input
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>

int a[3], b[3];
int l, s;
std::vector<int> choose{0, 1, 2};
std::string out = "ABC";

bool try_it()
{
	if (a[choose[0]] == a[choose[1]] && a[choose[0]] == a[choose[2]] && a[choose[0]] == l && b[choose[0]] + b[choose[1]] + b[choose[2]] == l) {
		std::cout << l << '\n';
		for (int k = 0; k < 3; k++) {
			for (int i = 0; i < b[choose[k]]; i++) {
				for (int j = 0; j < a[choose[k]]; j++) std::cout << out[choose[k]];
				std::cout << '\n';
			}
		}
		return true;
	}

	if (a[choose[0]] == l && a[choose[0]] == a[choose[1]] + a[choose[2]] && b[choose[0]] + b[choose[1]] == l && b[choose[1]] == b[choose[2]]) {
		std::cout << l << '\n';
		for (int i = 0; i < b[choose[0]]; i++) {
			for (int j = 0; j < a[choose[0]]; j++) std::cout << out[choose[0]];
			std::cout << '\n';
		}
		for (int i = 0; i < b[choose[1]]; i++) {
			for (int j = 0; j < a[choose[1]]; j++) std::cout << out[choose[1]];
			for (int j = 0; j < a[choose[2]]; j++) std::cout << out[choose[2]];
			std::cout << '\n';
		}
		return true;
	}
	return false;
}

bool check()
{
	for (int i = 0; i < 2; i++) {
		std::swap(a[choose[0]], b[choose[0]]);
		for (int j = 0; j < 2; j++) {
			std::swap(a[choose[1]], b[choose[1]]);
			for (int k = 0; k < 2; k++) {
				std::swap(a[choose[2]], b[choose[2]]);
				if (try_it()) return true;
			}
		}
	}
	return false;
}

int main()
{
	for (int i = 0; i < 3; i++) {
		std::cin >> a[i] >> b[i];
		if (a[i] < b[i]) std::swap(a[i], b[i]);
		s += a[i] * b[i];
	}
	l = std::sqrt(s);
	if (l * l != s) {
		std::cout << "-1\n";
		return 0;
	}

	do {
		if (check()) return 0;
	} while (std::next_permutation(choose.begin(), choose.end()));

	std::cout << "-1\n";
}

